package pl.pkolodziej.platform.vo.course;

import java.sql.Timestamp;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name="user_course_info")
public class UserCourseInfo {

	@Id
	@Column(name="id")
	@GeneratedValue(strategy = GenerationType.AUTO)
	private String id;

	@Column(name="username")
	private String username;
	
	@Column(name="score")
	private int score = 0;
	
	@Column(name="endtest")
	private int endtest = 0;
	
	@Column(name="starttest")
	private int starttest = 0;

	@Column(name="pages")
	private int pages = 0;

	@Column(name="lastattempt")
	private Timestamp lastattempt = null;
	
	@OneToOne(cascade=CascadeType.ALL)
	@JoinColumn(name="course_id")
	private Course course;
	
	@Column(name="starttest_done")
	private Boolean starttest_done = false;
	
	@Column(name="endtest_done")
	private Boolean endtest_done = false;
	
	@Column(name="starttest_state")
	private String starttest_state = "";
	
	@Column(name="endtest_state")
	private String endtest_state = "";
	
	public String getStarttest_state() {
		return starttest_state;
	}

	public void setStarttest_state(String starttest_state) {
		this.starttest_state = starttest_state;
	}

	public String getEndtest_state() {
		return endtest_state;
	}

	public void setEndtest_state(String endtest_state) {
		this.endtest_state = endtest_state;
	}

	@Transient
	private float pagesProgress = 0;
	@Transient
	private float startTestProgress = 0;
	@Transient
	private float endTestProgress = 0;
	
	
	public Boolean getStarttest_done() {
		return starttest_done;
	}

	public void setStarttest_done(Boolean starttest_done) {
		this.starttest_done = starttest_done;
	}

	public Boolean getEndtest_done() {
		return endtest_done;
	}

	public void setEndtest_done(Boolean endtest_done) {
		this.endtest_done = endtest_done;
	}
	
	public float getPagesProgress() {
		return pagesProgress;
	}

	public void setPagesProgress(float pagesProgress) {
		this.pagesProgress = pagesProgress;
	}

	public float getStartTestProgress() {
		return startTestProgress;
	}

	public void setStartTestProgress(float startTestProgress) {
		this.startTestProgress = startTestProgress;
	}

	public float getEndTestProgress() {
		return endTestProgress;
	}

	public void setEndTestProgress(float endTestProgress) {
		this.endTestProgress = endTestProgress;
	}

	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Course getCourse() {
		return course;
	}

	public void setCourse(Course course) {
		this.course = course;
	}

	public int getScore() {
		return score;
	}

	public void setScore(int score) {
		this.score = score;
	}

	public Timestamp getLastattempt() {
		return lastattempt;
	}

	public void setLastattempt(Timestamp lastattempt) {
		this.lastattempt = lastattempt;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public int getPages() {
		return pages;
	}

	public void setPages(int pages) {
		this.pages = pages;
	}
	
	public int getEndtest() {
		return endtest;
	}

	public void setEndtest(int endtest) {
		this.endtest = endtest;
	}

	public int getStarttest() {
		return starttest;
	}

	public void setStarttest(int starttest) {
		this.starttest = starttest;
	}
	
}
